#include <iostream>
#include <vector>
using namespace std;

// Definition for a binary tree node.
struct TreeNode {
     int val;
     TreeNode *left;
     TreeNode *right;
     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
    TreeNode* sortedArrayToBST(vector<int>& nums) 
    {
        return dfs(nums,0,nums.size()-1);
    }
    TreeNode* dfs(vector<int>& nums,int L,int R)
    {
        if(L <= R)
        {
            int m = (L + R) >> 1;
            TreeNode* root = new TreeNode(nums[m]);
            root->left = dfs(nums,L,m-1);
            root->right = dfs(nums,m+1,R);
            return root;
        }
        else{ return nullptr; }
    }
};

int main()
{
    return 0;
}